package com.glory.wxmemsicpda.adapter

import com.chad.library.adapter.base.BaseQuickAdapter
import com.glory.wxmemsicpda.R
import com.glory.wxmemsicpda.base.DataBindBaseViewHolder
import com.glory.wxmemsicpda.bean.SheetInfoBean
import com.glory.wxmemsicpda.databinding.AdapterCheckQueryBinding

/**
 * @Author Zhangjy
 * @Date 2021/5/31 11:38
 * Description :点检履历适配器
 */
class CheckQueryListAdapter(data: List<SheetInfoBean?>?) :
    BaseQuickAdapter<SheetInfoBean?, DataBindBaseViewHolder>(
        R.layout.adapter_check_query,
        data as MutableList<SheetInfoBean?>?
    ) {

    private var mListener:OnClickListener? = null

    override fun convert(helper: DataBindBaseViewHolder, item: SheetInfoBean?) {
        val binding: AdapterCheckQueryBinding =
            helper.getDataBinding() as AdapterCheckQueryBinding

        binding.sheetInfoBean = item
        binding.executePendingBindings()

        binding.tvCheckStatus.setOnClickListener {
            if (mListener != null) {
                mListener!!.onCheckListener(item)
            }
        }

    }

    interface OnClickListener {
        fun onCheckListener(item: SheetInfoBean?)
    }

    fun setOnCheckListener(listener: OnClickListener) {
        this.mListener = listener
    }
}